package com.learning.security.dal.mysql;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.learning.security.dal.dataobject.AdminOAuth2AccessTokenDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 * OAuth2 访问令牌 Mapper 接口
 * </p>
 *
 * @author xxx
 * @since 2024-10-03
 */
@Mapper
public interface AdminOauth2AccessTokenMapper extends BaseMapper<AdminOAuth2AccessTokenDO> {

    default AdminOAuth2AccessTokenDO selectByAccessToken(String accessToken) {
        LambdaQueryWrapper<AdminOAuth2AccessTokenDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AdminOAuth2AccessTokenDO::getAccessToken, accessToken);
        return selectOne(queryWrapper);
    }


}
